<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/tomato.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/tomato-16.png">
  <link rel="mask-icon" href="/blog/images/logo.svg" color="#222">

<link rel="stylesheet" href="/blog/css/main.css">


<link rel="stylesheet" href="/blog/lib/font-awesome/css/all.min.css">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"linfanqie.gitee.io","root":"/blog/","scheme":"Mist","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":true,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="介绍： 本系列主要根据Hexo官方文档，同时结合自己在使用过程中的一些心得进行总结，与大家分享。">
<meta property="og:type" content="article">
<meta property="og:title" content="Hexo搭建个人博客（一）">
<meta property="og:url" content="https://linfanqie.gitee.io/2021/03/01/Hexo%E7%B3%BB%E5%88%97%EF%BC%88%E4%B8%80%EF%BC%89/index.html">
<meta property="og:site_name" content="林番茄的Blog">
<meta property="og:description" content="介绍： 本系列主要根据Hexo官方文档，同时结合自己在使用过程中的一些心得进行总结，与大家分享。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://linfanqie.gitee.io/blog/2021/03/01/Hexo%E7%B3%BB%E5%88%97%EF%BC%88%E4%B8%80%EF%BC%89/index.jpg">
<meta property="article:published_time" content="2021-03-01T08:03:04.000Z">
<meta property="article:modified_time" content="2021-03-31T10:45:27.516Z">
<meta property="article:author" content="林番茄">
<meta property="article:tag" content="Hexo系列">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://linfanqie.gitee.io/blog/2021/03/01/Hexo%E7%B3%BB%E5%88%97%EF%BC%88%E4%B8%80%EF%BC%89/index.jpg">

<link rel="canonical" href="https://linfanqie.gitee.io/2021/03/01/Hexo%E7%B3%BB%E5%88%97%EF%BC%88%E4%B8%80%EF%BC%89/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>Hexo搭建个人博客（一） | 林番茄的Blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/blog/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">林番茄的Blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">世界那么大，总得慢慢看。</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/blog/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/blog/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/blog/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://linfanqie.gitee.io/2021/03/01/Hexo%E7%B3%BB%E5%88%97%EF%BC%88%E4%B8%80%EF%BC%89/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/cate.jpg">
      <meta itemprop="name" content="林番茄">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="林番茄的Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Hexo搭建个人博客（一）
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-03-01 16:03:04" itemprop="dateCreated datePublished" datetime="2021-03-01T16:03:04+08:00">2021-03-01</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2021-03-31 18:45:27" itemprop="dateModified" datetime="2021-03-31T18:45:27+08:00">2021-03-31</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/Hexo%E7%B3%BB%E5%88%97/" itemprop="url" rel="index"><span itemprop="name">Hexo系列</span></a>
                </span>
            </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>1.6k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>1 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p><strong>介绍：</strong> 本系列主要根据Hexo官方文档，同时结合自己在使用过程中的一些心得进行总结，与大家分享。</p>
<span id="more"></span>

<h3 id="Hexo简介"><a href="#Hexo简介" class="headerlink" title="Hexo简介"></a>Hexo简介</h3><p>什么是Hexo？或许引用官方文档中的说明再好不过了：</p>
<blockquote>
<p>Hexo是一个快速、简介高效的博客框架，Hexo使用Markdown（或其他的渲染引擎）解析文章，几秒内即可利用靓丽的主题生成静态网页。</p>
</blockquote>
<h3 id="Hexo的安装前提-（必需）"><a href="#Hexo的安装前提-（必需）" class="headerlink" title="Hexo的安装前提 （必需）"></a>Hexo的安装前提 （必需）</h3><p>1、安装Node.js(是一个基于 Chrome V8 引擎的 JavaScript 运行时)</p>
<blockquote>
<p>Node.js(版本不得低于10.13，建议使用12.0以上版本) 官网下载地址（根据自身的操作系统选择下载）：<a target="_blank" rel="noopener" href="http://nodejs.cn/download/">http://nodejs.cn/download/</a> (一般默认傻瓜式安装即可)<br>下载完成后打开CMD或终端（macOS系统）界面输入 node -v 命令查看node版本，输入 npm -v 查看npm版本，用于验证是否安装成功！</p>
<figure class="highlight apache"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">node</span> -v</span><br><span class="line"><span class="attribute">v14</span>.<span class="number">14</span>.<span class="number">0</span></span><br><span class="line"><span class="attribute">npm</span> -v</span><br><span class="line"><span class="attribute">6</span>.<span class="number">14</span>.<span class="number">8</span></span><br></pre></td></tr></table></figure>
</blockquote>
<p>2、安装Git</p>
<blockquote>
<p>Git：一个开源的分布式版本控制系统<br>下载地址（根据自身的操作系统选择下载）：<a target="_blank" rel="noopener" href="https://git-scm.com/downloads">https://git-scm.com/downloads</a> (一般默认傻瓜式安装即可)<br>打开CMD或终端（macOS系统）界面输入：git –version ；如若显示出版本则代表安装成功<br><strong>Git安装提醒：</strong> macOS系统的用户编译遇到问题时候，可到App Store安装Xcode，安装完成后启动进入Preferences -&gt; Download -&gt; Command Line Tools -&gt; Install 安装命令行工具</p>
</blockquote>
<h3 id="Hexo安装"><a href="#Hexo安装" class="headerlink" title="Hexo安装"></a>Hexo安装</h3><p>npm是一个包管理工具，因此可以使用 npm 安装Hexo</p>
<blockquote>
<figure class="highlight avrasm"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g hexo-<span class="keyword">cli</span></span><br></pre></td></tr></table></figure>
<p>-g代表全局安装</p>
</blockquote>
<p>安装完成之后，输入命令 hexo -v 查看Hexo版本，验证是否安装成功！</p>
<blockquote>
<figure class="highlight ldif"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">$ hexo -v</span><br><span class="line"><span class="attribute">hexo-cli</span>: 4.2.0</span><br><span class="line"><span class="attribute">os</span>: Darwin 18.7.0 darwin x64</span><br><span class="line"><span class="attribute">node</span>: 14.14.0</span><br><span class="line"><span class="attribute">v8</span>: 8.4.371.19-node.17</span><br><span class="line"><span class="attribute">uv</span>: 1.40.0</span><br><span class="line"><span class="attribute">zlib</span>: 1.2.11</span><br><span class="line"><span class="attribute">brotli</span>: 1.0.9</span><br><span class="line"><span class="attribute">ares</span>: 1.16.1</span><br><span class="line"><span class="attribute">modules</span>: 83</span><br><span class="line"><span class="attribute">nghttp2</span>: 1.41.0</span><br><span class="line"><span class="attribute">napi</span>: 7</span><br><span class="line"><span class="attribute">llhttp</span>: 2.1.3</span><br><span class="line"><span class="attribute">openssl</span>: 1.1.1g</span><br><span class="line"><span class="attribute">cldr</span>: 37.0</span><br><span class="line"><span class="attribute">icu</span>: 67.1</span><br><span class="line"><span class="attribute">tz</span>: 2020a</span><br><span class="line"><span class="attribute">unicode</span>: 13.0</span><br></pre></td></tr></table></figure>
</blockquote>
<h3 id="建站"><a href="#建站" class="headerlink" title="建站"></a>建站</h3><p>1、Hexo安装完成后，执行以下命令，Hexo将会在指定文件夹中建立所需文件。</p>
<blockquote>
<p>两步可选其一：<br>1、在合适的地方新建一个文件夹，CMD或终端（macOS）跳转至此文件夹进行操作：hexo init 初始化该文件夹作为Hexo根目录<br>2、直接在CMD或终端（macOS）中输入：hexo init &lt;文件夹名称&gt; 会直接新创一个文件夹并初始化作为Hexo根目录<br>npm install ；安装依赖包</p>
</blockquote>
<p>建立完成后：文件夹目录如下</p>
<blockquote>
<figure class="highlight gradle"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">├── _config.yml :博客网站的配置信息</span><br><span class="line">├── <span class="keyword">package</span>.json</span><br><span class="line">├── scaffolds：模板文件夹 </span><br><span class="line">├── <span class="keyword">source</span> ：资源文件夹</span><br><span class="line">|   └── _posts ：存放文章</span><br><span class="line">└── themes ：主题（根据主题生成静态页面）</span><br></pre></td></tr></table></figure>
</blockquote>
<p>2、测试<br>上面步骤到此，利用Hexo搭建的个人博客网站可以在本地正常运行了。<br>执行命令：</p>
<blockquote>
<p>1.hexo clean (如若在新建的文件或图片等资源显示异常的话，可执行此命令清除缓存和已存在的静态文件，然后再输入一遍第2行命令和第3行命令)<br>2.hexo g (全称：generate 自动根据当前目录文件，生成新的静态网页)<br>3.hexo s (全称：server 运行本地服务)<br>如若需要将本地项目部署到远程地址（如：github，如何部署地址可在第二篇文章《deploy》处查看到）部署好地址后执行第4步命令<br>4.hexo d<br>启动成功后将显示以下此页面：</p>
<img src="/blog/2021/03/01/Hexo%E7%B3%BB%E5%88%97%EF%BC%88%E4%B8%80%EF%BC%89/index.jpg" class="" title="首页页面">
</blockquote>

    </div>

    
    
    
        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>林番茄
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="https://linfanqie.gitee.io/2021/03/01/Hexo%E7%B3%BB%E5%88%97%EF%BC%88%E4%B8%80%EF%BC%89/" title="Hexo搭建个人博客（一）">https://linfanqie.gitee.io/2021/03/01/Hexo系列（一）/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="noopener" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>


      <div>
        
          <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------</div>
    
</div>

        
      </div>

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/blog/tags/Hexo%E7%B3%BB%E5%88%97/" rel="tag"># Hexo系列</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item"></div>
      <div class="post-nav-item">
    <a href="/blog/2021/03/02/Hexo%E7%B3%BB%E5%88%97%EF%BC%88%E4%BA%8C%EF%BC%89/" rel="next" title="Hexo搭建个人博客（二）">
      Hexo搭建个人博客（二） <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#Hexo%E7%AE%80%E4%BB%8B"><span class="nav-number">1.</span> <span class="nav-text">Hexo简介</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Hexo%E7%9A%84%E5%AE%89%E8%A3%85%E5%89%8D%E6%8F%90-%EF%BC%88%E5%BF%85%E9%9C%80%EF%BC%89"><span class="nav-number">2.</span> <span class="nav-text">Hexo的安装前提 （必需）</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Hexo%E5%AE%89%E8%A3%85"><span class="nav-number">3.</span> <span class="nav-text">Hexo安装</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%BB%BA%E7%AB%99"><span class="nav-number">4.</span> <span class="nav-text">建站</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="林番茄"
      src="/blog/images/cate.jpg">
  <p class="site-author-name" itemprop="name">林番茄</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/blog/archives/">
        
          <span class="site-state-item-count">5</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/blog/categories/">
          
        <span class="site-state-item-count">1</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">1</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="cc-license motion-element" itemprop="license">
    <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" rel="noopener" target="_blank"><img src="/blog/images/cc-by-nc-sa.svg" alt="Creative Commons"></a>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-star"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">林番茄</span>
</div>
<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
  <!--
    <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://mist.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Mist</a> 强力驱动
    </div>
    -->
    <div class="powered-by">
    <i class="fa fa-user-md"></i><span id="busuanzi_container_site_uv">
      本站访客数:<span id="busuanzi_value_site_pv"></span>
    </span>
    </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/blog/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js"></script>
  <script src="/blog/lib/velocity/velocity.min.js"></script>
  <script src="/blog/lib/velocity/velocity.ui.min.js"></script>

<script src="/blog/js/utils.js"></script>

<script src="/blog/js/motion.js"></script>


<script src="/blog/js/schemes/muse.js"></script>


<script src="/blog/js/next-boot.js"></script>




  















  

  

<script src="/blog/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","model":{"jsonPath":"/blog/live2dw/assets/hijiki.model.json"},"display":{"position":"right","width":150,"height":300},"mobile":{"show":true},"log":false,"tagMode":false});</script></body>
</html>
